#!/usr/bin/python
#coding:utf-8

import os  
  
  
class CashSuper(object):  
    def accept_cash(self, money):  
        return 0  
  
  
class CashNormal(CashSuper):  
    def accept_cash(self, money):  
        return money  
  
  
class CashRebate(CashSuper):  
    discount = 0  
  
    def __init__(self, ds):  
        self.discount = ds  
  
    def accept_cash(self, money):  
        return money * self.discount  
  
  
class CashReturn(CashSuper):  
    total = 0  
    ret = 0  
  
    def __init__(self, total, ret):  
        self.total = total  
        self.ret = ret  
  
    def accept_cash(self, money):  
        if money >= self.total:  
            return money - self.ret  
        else:  
            return money  
  
  
class CashContext:  
    def __init__(self, child_class):  
        self.cs = child_class  
  
    def get_result(self, money):  
        return self.cs.accept_cash(money)  
  
  
def main():  
    print "*" * 30  
    money = input("money:")  
    strategy = dict()  
    strategy[1] = CashContext(CashNormal())  
    strategy[2] = CashContext(CashRebate(0.8))  
    strategy[3] = CashContext(CashReturn(300, 100))  
    ctype = input("type:[1]for normal,[2]for 80% discount [3]for 300 -100.")  
    if ctype in strategy:  
        cc = strategy[ctype]  
    else:  
        print "no define type. Use normal mode."  
        cc = strategy[1]  
    print "you will pay:%d" % cc.get_result(money)
  
  
if __name__ == "__main__":  
    main()  